package com.nick.job.domain;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.nick.job.constant.ScheduleConstants;
import com.nick.job.util.CronUtils;


/**
 * 定时任务调度信息 sys_job
 * 
 * @author ruoyi
 * 
 * @version dcliu
 * 
 */
public class Job implements Serializable
{

	private static final long serialVersionUID = -6726539861060633407L;

	/** 任务ID */
    private String jobId;

    /** 任务名称 */
    private String jobName;

    /** 任务组名 */
    private String jobGroup;

    /** 任务方法 */
    private String methodName;

    /** 方法参数 */
    private String methodParams;

    /** cron执行表达式 */
    private String cronExpression;

    /** cron计划策略 */
    private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;

    /** 是否并发执行（0允许 1禁止） */
    private String concurrent;

    /** 任务状态（0正常 1暂停） */
    private String status;
    
    //0,执行中,1,执行成功,2,执行失败
    private String executestatus;
    
   



    public String getExecutestatus() {
        return executestatus;
    }

    public void setExecutestatus(String executestatus) {
        this.executestatus = executestatus;
    }

    private String remark;

    /** 创建人, */
    private String inputUserId;
    /** 创建时间, */
    private String inputTime;
    /** 更新人, */
    private String updateUserId;
    /** 更新时间, */
    private String updateTime;
    
    
    public String getJobId()
    {
        return jobId;
    }

    public void setJobId(String jobId)
    {
        this.jobId = jobId;
    }

    public String getJobName()
    {
        return jobName;
    }

    public void setJobName(String jobName)
    {
        this.jobName = jobName;
    }

    public String getJobGroup()
    {
        return jobGroup;
    }

    public void setJobGroup(String jobGroup)
    {
        this.jobGroup = jobGroup;
    }

    public String getMethodName()
    {
        return methodName;
    }

    public void setMethodName(String methodName)
    {
        this.methodName = methodName;
    }

    public String getMethodParams()
    {
        return methodParams;
    }

    public void setMethodParams(String methodParams)
    {
        this.methodParams = methodParams;
    }

    public String getCronExpression()
    {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression)
    {
        this.cronExpression = cronExpression;
    }

    public Date getNextValidTime()
    {
        if (StringUtils.isNotEmpty(cronExpression))
        {
            return CronUtils.getNextExecution(cronExpression);
        }
        return null;
    }

    public String getMisfirePolicy()
    {
        return misfirePolicy;
    }

    public void setMisfirePolicy(String misfirePolicy)
    {
        this.misfirePolicy = misfirePolicy;
    }

    public String getConcurrent()
    {
        return concurrent;
    }

    public void setConcurrent(String concurrent)
    {
        this.concurrent = concurrent;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }
    
    public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/** @param 创建人, */
    public void setInputUserId(String inputUserId) {
        this.inputUserId = inputUserId;
    }
    /** @return 创建人, */
    public String getInputUserId() {
        return this.inputUserId;
    }
    /** @param 创建时间, */
    public void setInputTime(String inputTime) {
        this.inputTime = inputTime;
    }
    /** @return 创建时间, */
    public String getInputTime() {
        return this.inputTime;
    }
    /** @param 更新人, */
    public void setUpdateUserId(String updateUserId) {
        this.updateUserId = updateUserId;
    }
    /** @return 更新人, */
    public String getUpdateUserId() {
        return this.updateUserId;
    }
    /** @param 更新时间, */
    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
    /** @return 更新时间, */
    public String getUpdateTime() {
        return this.updateTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("jobId", getJobId())
            .append("jobName", getJobName())
            .append("jobGroup", getJobGroup())
            .append("methodName", getMethodName())
            .append("methodParams", getMethodParams())
            .append("cronExpression", getCronExpression())
            .append("nextValidTime", getNextValidTime())
            .append("misfirePolicy", getMisfirePolicy())
            .append("concurrent", getConcurrent())
            .append("status", getStatus())
            .toString();
    }
}